package com.shycloud.mido.common.pay.wxpay.WXUtils;
import java.io.*;
import com.shycloud.mido.common.pay.wxpay.WXUtils.WXPayConfig;
/**
 * @ClassName MyConfig
 * @Description: TODO
 * @Author: Trank (LiuW)
 * @Date 2019/12/13
 * @Version V1.0
 **/
public class MyConfig extends WXPayConfig {
	private byte[] certData;

//	public MyConfig() throws Exception {
//		String certPath = "/path/to/apiclient_cert.p12";
//		File file = new File(certPath);
//		InputStream certStream = new FileInputStream(file);
//		this.certData = new byte[(int) file.length()];
//		certStream.read(this.certData);
//		certStream.close();
//	}
    @Override
//	public String getAppID() {
//		return "wx8888888888888888";
//	}
	public String getAppID() {
		return "wxe06436c290989c3f";
	}
	@Override
//	public String getMchID() {
//		return "12888888";
//	}
	public String getMchID() {
		return "1532597271";
	}
	@Override
//	public String getKey() {
//		return "88888888888888888888888888888888";
//	}
	public String getKey() {
		return "3a1f6bb479a9484784d78da88caafcb2";
	}
	@Override
	public InputStream getCertStream() {
		ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
		return certBis;
	}
	@Override
	public int getHttpConnectTimeoutMs() {
		return 8000;
	}
	@Override
	public int getHttpReadTimeoutMs() {
		return 10000;
	}
	/**
	 * 获取WXPayDomain, 用于多域名容灾自动切换
	 * 实现这个接口
	 * @return
	 */
	@Override
	public IWXPayDomain getWXPayDomain() {

			IWXPayDomain iwxPayDomain = new IWXPayDomain() {
				public void report(String domain, long elapsedTimeMillis, Exception ex) {
				}
				public DomainInfo getDomain(WXPayConfig config) {
					return new IWXPayDomain.DomainInfo(WXPayConstants.DOMAIN_API, true);
				}
			};
			return iwxPayDomain;
	}
}
